package com.example.controller;

import com.example.pojo.Account;
import com.example.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/accounts")
public class AccountController {
    @Autowired
    AccountService accountService;

    @PostMapping
    public Result match(@RequestBody Account account){
        boolean match = accountService.match(account);
        String msg = match!=false?"账户存在":"账户不存在";
        return new Result(match,match? Code.GET_OK:Code.GET_ERROR,msg);
    }
}
